<template>
	<view>
		<view class="gd_menus">
			<view class="shopTuijian">
				<scroll-view class="uni-swiper-tab" scroll-x>
					<view class="scrollx_items" v-for="(item,index) in FenLeiList" :key="index" @click="ClickGDMenus(item,index)">
						<view class="ren_info">
							<image :src="item.image" :class="[GDMenuIdx == index?'gdxz':'']"></image>
							<view class="fubiaotiWrap" :class="[GDMenuIdx == index?'huisesss':'']">{{item.name}}</view>
						</view>
					</view>
				</scroll-view>
			</view>
		</view>
	</view>
</template>

<script>
	const app = getApp();
	export default {
		name: "home-scroll-menus",
		props: {
			FenLeiList: {
				type: Array,
				default: []
			}
		},
		data() {
			return {
				GDMenuIdx: 0,
				BestImgUrl: app.globalData.imgurl
			};
		},
		methods: {
			guiWei(){
				this.GDMenuIdx = 0
			},
			ClickGDMenus(item, index) {
				this.GDMenuIdx = index
				console.log('点击了分类',item)
				this.$emit("ClickScrMenu",item)
			}
		}
	}
</script>

<style lang="scss">
	/deep/ scroll-view ::-webkit-scrollbar {
		display: none;
		width: 0;
		height: 0;
		color: transparent;
	}
	.gd_menus {
		margin: 24rpx 0;

		.shopTuijian {
			.uni-swiper-tab {
				white-space: nowrap;

				.scrollx_items {
					text-align: left;
					display: inline-block;
					width: 110rpx;
					margin-right: 20rpx;

					.ren_info {
						text-align: center;
						position: relative;
						//opacity: .6;

						image {
							width: 80rpx;
							height: 80rpx;
							margin-bottom: 10rpx;
							padding: 10rpx;
							border-radius: 200rpx;
						}

						.gdxz {
							background-color: #FFE8E1 !important;
							border: 2px solid transparent !important;
							border-radius: 200rpx;
							background-clip: padding-box, border-box;
							background-origin: padding-box, border-box;
							background-image: linear-gradient(to bottom, #FFE8E1, #FFE8E1), linear-gradient(to bottom, #FFE8E1, #FFB393);
						}

						.fubiaotiWrap {
							font-size: 24rpx;
							color: #666666;
							word-break: break-all;
							display: -webkit-box;
							-webkit-line-clamp: 1;
							-webkit-box-orient: vertical;
							overflow: hidden;
						}
						.huisesss {
							color: #333333 !important;
							font-weight: bold;
						}
					}

				}

				.scrollx_items:first-child {
					//margin-left: 30rpx;
				}

				.scrollx_items:last-child {
					margin-right: 0;
				}
			}
		}
	}
</style>